package com.ark.controller;

import com.ark.common.domain.model.RegisterBody;
import com.ark.common.response.Result;
import com.ark.security.service.RegisterService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.validation.Valid;

@RestController
public class RegisterController {

    @Resource
    private RegisterService registerService;


    @PostMapping("/register")
    public Result register(@Valid @RequestBody RegisterBody registerBody){
        if (!registerService.register(registerBody)){
            return Result.error("注册失败");
        }
        return Result.success();
    }

}
